/*
day69
2019.11.5
*/
#include<vector>
#include<stdlib.h>
using namespace std;

struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
};



class Solution {
public:
	void help(struct TreeNode *root,vector<int> &vec)
	{
		if(!root) return;
		
		help(root->left,vec);
		
		if(!root->left && !root->right) vec.push_back(root->val);
		
		help(root->right,vec);
	}
	
	
    bool leafSimilar(TreeNode* root1, TreeNode* root2) {
        vector<int> vec1;
        vector<int> vec2;
        
        help(root1,vec1);
        help(root2,vec2);
        
    	if(vec1.size() !=vec2.size()) return false;
    	
    	for(int i=0;i<vec1.size();i++)
    	{
    		if(vec1[i] !=vec2[i]) return false;
		}
		return true;
    }
};

int main()
{
	return 0;
}
